package com.sasis.webapp.dwr;

import com.sasis.model.VipServiceSheet;
import com.sasis.model.VipInfo;
import com.sasis.model.VipType;
import com.sasis.service.VipInfoManager;
import com.sasis.service.VipTypeManager;

public class VipServiceInfo {
private VipInfoManager vipInfoManager; 
private VipTypeManager vipTypeManager; 
	
	public void setVipInfoManager(VipInfoManager vipInfoManager) {
		this.vipInfoManager = vipInfoManager;
	}
	
	public void setVipTypeManager(VipTypeManager vipTypeManager) {
		this.vipTypeManager = vipTypeManager;
	}
	
	public VipServiceSheet getVipServiceInfo(String idCard){
		VipServiceSheet vipServiceSheet = new VipServiceSheet();
		VipInfo vipInfo=vipInfoManager.getVipInfoDwr(idCard);
		if(vipInfo!=null&&vipInfo.getVipTypeId()!=null){
			VipType vipType=vipTypeManager.getVipType(String.valueOf(vipInfo.getVipTypeId()));
			
			vipServiceSheet.setVipInfoId(vipInfo.getId());
			vipServiceSheet.setName(vipInfo.getName());
			vipServiceSheet.setIdCard(vipInfo.getIdCard());
			vipServiceSheet.setGender(vipInfo.getGender());
			vipServiceSheet.setDuty(vipInfo.getDuty());
			vipServiceSheet.setVipTypeId(vipInfo.getVipTypeId());
			vipServiceSheet.setCardNum(vipInfo.getCardNum());
			vipServiceSheet.setMobile(vipInfo.getMobile());
			vipServiceSheet.setServiceDesire(vipInfo.getServiceDesc());
			
			if(vipType!=null){
				vipServiceSheet.setBookTicket(vipType.getBookTicket());
				vipServiceSheet.setProvideFood(vipType.getProvideFood());
				vipServiceSheet.setSentCar(vipType.getSentCar());
				vipServiceSheet.setBoardCheck(vipType.getBoardCheck());
				vipServiceSheet.setReceivedMan(vipType.getReceivedMan());
				vipServiceSheet.setVisitantRoom(vipType.getVisitantRoom());
				vipServiceSheet.setCabinService(vipType.getCabinService());
				vipServiceSheet.setReceivedCar(vipType.getReceivedCar());
				vipServiceSheet.setOther(vipType.getOther());
				//viptype name
				vipServiceSheet.setVipTypeName(vipType.getName());
			}
		}else{
			vipServiceSheet=null;
		}
		return vipServiceSheet;
	}
	
	public VipType getVipTypeInfo(String vipTypeId){
		VipType vipType=new VipType();
		vipType=vipTypeManager.getVipType(vipTypeId);
		return vipType;
	}
	
	
}